package com.tqw.item.aop;

import com.tqw.entity.Result;
import com.tqw.entity.StatusCode;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;


/**
 * 全局异常处理
 * @Author Alex
 */
@RestControllerAdvice
public class SystemException {

    /**
     * 拦截运行时异常 RunTimeException
     */
    @ExceptionHandler(RuntimeException.class)
    public Result<?> fail(Exception e){
        e.printStackTrace();
        return new Result<>(false, StatusCode.ERROR,"系统异常,请稍后再试");
    }
}
